<!DOCTYPE html>
<html lang="en">
<head>
    <script src="../js/vue.js"></script>
    <title>条件渲染</title>
</head>
<body>

    <!-- 
        v-if 和 v-show
            v-if会删除不显示的DOM节点
            v-show只是隐藏DOM节点,还可以获取
     -->
     <div id="root">
        <h2>今天天气{{isHot?'炎热':'凉爽'}}</h2>
        <button @click="isHot = !isHot">天气切换</button>
        <!-- v-show -->
        <!-- <div v-show='isHot'>
            天气炎热,穿T恤
        </div>
        <div v-show='!isHot'>
            天气凉爽,穿秋裤吧
        </div> -->

        <!-- v-if -->
        <div v-if='isHot==true'>
            天气炎热,穿T恤
        </div>
        <div v-else>
            天气凉爽,穿秋裤吧
        </div>
    </div>

    <script>
        new Vue({
            el:'#root',
            data:{
                isHot:true,
            },
            methods:{

            }
        });
    </script>
</body>
</html>